package com.dj.ssm.web.page;

import com.dj.ssm.entity.ExamQ;
import com.dj.ssm.service.ExamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/exam")
public class ExamPageController {

    @Autowired
    private ExamService examService;

    @RequestMapping("/toShow")
    private String toLost(){

        return "/exam/show";
    }

    @RequestMapping("/toInsert")
    private String toInsert(){

        return "/exam/insert";
    }

    @RequestMapping("/toInsertUser/{examId}")
    private String toInsertUser(@PathVariable Integer examId, ModelMap map ){
        map.put("examId", examId);
        return "/exam/user_insert";
    }

    @RequestMapping("/toQueryList/{examId}")
    private String toQueryList(@PathVariable Integer examId, ModelMap map ){
        ExamQ exam = examService.queryExam(examId);
        map.put("examId", examId);
        map.put("exam", exam);
        return "/exam/user_list";
    }
}
